﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2._5_字符串.生成字符串
{
    public partial class gyyx : Form
    {
        public gyyx()
        {
            InitializeComponent();
        }

        private void gyyx_Load(object sender, EventArgs e)
        {
            string strTmp = "添加数量\n网段别名\n网段别名*";
            this.richTextBox1.Text = strTmp;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string s1 = this.richTextBox1.Text;
            char[] split = new char[] { '\n' };
            string[] temp1 = s1.Split(split);
            List<string> temp = new List<string>();

            for (int i = 0; i < temp1.Length; i++)
            {
                if (temp1[i].Trim() != "")
                {
                    temp.Add(temp1[i].Trim());
                }
            }

            StringBuilder strTrans = new StringBuilder();

            strTrans.Append("<?php\n");
            strTrans.Append("defined('IN_ADMIN') or exit('Access Denied');\n");
            strTrans.Append("include_once (SITE_ROOT.'/include/models/html/html.class.php');\n");
            strTrans.Append("?>\n");
            strTrans.Append("<!--//start_zr******************-->\n");
            strTrans.Append("<div id=\"box\">\n");
            strTrans.Append("<h3 id=\"adduser\">批量添加IP信息</h3>\n");
            strTrans.Append("\n");
            strTrans.Append("<form id=\"form\" action=\"?file=<?=$file?>&action=<?=$action?>\" method=\"post\" name=\"myform\">\n");
            strTrans.Append("	\n");
            strTrans.Append("<fieldset id=\"personal\"><legend>内容模型管理</legend>\n");
            strTrans.Append("\n");
            strTrans.Append("<!--//start_zr******************-->\n");

            foreach (string strIn in temp)
            {
                if (strIn.IndexOf("*") != -1)
                {
                    strTrans.Append("<p>\n");
                    strTrans.Append("<label >\n");
                    strTrans.Append("<font color=\"red\">*</font> \n");
                    strTrans.Append("<strong>" + strIn + "</strong>\n");
                    strTrans.Append("</label> \n");
                    strTrans.Append("<input type=\"text\" name=\"info[name]\">\n");
                    strTrans.Append("</p>\n");
                }
                else
                {
                    strTrans.Append("<p>\n");
                    strTrans.Append("<label>\n");
                    strTrans.Append("<strong>" + strIn + "</strong>\n");
                    strTrans.Append("</label>\n");
                    strTrans.Append(" <input type=\"text\" name=\"number\" size=\"4\" >\n");
                    strTrans.Append("</p>\n");
                }
            }

            strTrans.Append("\n");
            strTrans.Append("<!--//start_zr******************-->\n");
            strTrans.Append("<p>\n");
            strTrans.Append("<input type=\"hidden\" name=\"forward\" 	value=\"?file=<?=$file?>&action=list\">\n");
            strTrans.Append("<label>&nbsp;</label>\n");
            strTrans.Append("<input type=\"submit\"	name=\"dosubmit\" value=\" 确定 \"> &nbsp;\n");
            strTrans.Append("<input type=\"reset\" name=\"reset\"	value=\" 清除 \">\n");
            strTrans.Append("</p>\n");
            strTrans.Append("\n");
            strTrans.Append("</fieldset>\n");
            strTrans.Append("</form>\n");
            strTrans.Append("</div>\n");

            this.richTextBox2.Text = strTrans.ToString();
        }
    }
}